#!/usr/local/env python3
#author:fonzie

#建库语句
CREATE DATABASE `perip` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

#建表语句针对ipapi
CREATE TABLE ipapi(
ip VARCHAR(15) primary key not null,
ip_as VARCHAR(255) DEFAULT NULL,
city VARCHAR(255) DEFAULT NULL,
country VARCHAR(70) DEFAULT NULL,
countryCode VARCHAR(10) DEFAULT NULL,
isp VARCHAR(255) DEFAULT NULL,
lat DOUBLE(9,9) DEFAULT NULL,
lon DOUBLE(9,9) DEFAULT NULL,
org VARCHAR(255) DEFAULT NULL,
region VARCHAR(10) DEFAULT NULL,
timezone VARCHAR(70) DEFAULT NULL,
FULLTEXT(ip)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE taobao_ip(
ip VARCHAR(15) primary key not null,
country VARCHAR(30) DEFAULT NULL,
area VARCHAR(255) DEFAULT NULL,
region VARCHAR(255) DEFAULT NULL,
city VARCHAR(255) DEFAULT NULL,
county VARCHAR(255) DEFAULT NULL,
isp VARCHAR(255) DEFAULT NULL,
country_id VARCHAR(255) DEFAULT NULL,
area_id VARCHAR(70) DEFAULT NULL,
region_id VARCHAR(70) DEFAULT NULL,
city_id VARCHAR(70) DEFAULT NULL,
county_id VARCHAR(70) DEFAULT NULL,
isp_id VARCHAR(70) DEFAULT NULL,
FULLTEXT(ip)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE sudops(
ip VARCHAR(15) primary key not null,
country VARCHAR(30) DEFAULT NULL,
city VARCHAR(255) DEFAULT NULL,
isp VARCHAR(30) DEFAULT NULL,
latitude DOUBLE(9,9) DEFAULT NULL,
longitude DOUBLE(9,9) DEFAULT NULL,
desc VARCHAR(255) DEFAULT NULL,
FULLTEXT(ip)
)ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


CREATE TABLE `NewTable` (
`ip`  varchar(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
`country`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`city`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`isp`  varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
`latitude`  double(9,9) NULL DEFAULT NULL ,
`longitude`  double(9,9) NULL DEFAULT NULL ,
`desc`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
PRIMARY KEY (`ip`),
FULLTEXT INDEX `ip` (`ip`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_general_ci
ROW_FORMAT=DYNAMIC
;

